<?php
if(!defined('PATH')) exit();

$query = $query->fetchAll();
if (count($query) == 0) {
	$this->archez->showMsg('No matching houses, <a href="' . PATH . '/houses/search/">click here</a> to go back.', 'error');
} else {
?>
<table border="0" cellpadding="8" cellspacing="1" width="100%">
	<tr class="head"><td width="5%">#</td><td>Name</td><td>Size</td><td>Price</td><td>Rent</td><td>Status</td><td></td></tr>
<?php
	$i = 1;
	foreach ($query as $house) {
		$status = 'empty';
		if ($house['owner'] != 0) {
			$status = 'rented';
		}
?>
	<tr><td><?=$i?>.</td><td><?=$house['name']?></td><td><?=$house['size']?> sqm</td><td><?=$house['price']?> gold</td><td><?=$house['rent']?> gold</td><td><?=$status?></td><td style="text-align: center;"><a href="<?=PATH?>/houses/show/<?=$house['id']?>">View</a></td></tr>
<?php
		$i++;
	}
?>
</table>
<?php
}
?>